//  跳转公告 文件的mixin

const NOTICE_TYPE_MAP_LIST = [
    {
        label: '政府采购意向',
        value: 'notice_purpose',
    },
    {
        label: '政府采购意向变更',
        value: 'notice_purpose_change',
    },
    {
        label: '招标公告',
        value: 'notice_bid',
    },
    {
        label: '中标公告',
        value: 'notice_win',
    },
    {
        label: '中标候选人公示',
        value: 'notice_candidate',
    },
    {
        label: '变更公告',
        value: 'notice_change',
    },
    {
        label: '文档',
        value: 'document',
    },
];

export default {
    methods: {
    //判断 收藏标讯类型
        noticeCollType(label) {
            var filtered = NOTICE_TYPE_MAP_LIST.filter(item => item.label === label);

            if (!filtered.length) {
                return '';
            }

            return filtered[0].value;
        },

        //打开公告详情
        openNotice(guid, noticetype, isNewPage = "true") {
            let url = `/notice?guid=${guid}&noticetype=${noticetype}`;

            if (isNewPage) {
            window.open(url);
            } else {
            // window.location.href = url;
            this.$router.push(url);
            }
        },
    },
}
